﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.IO;

namespace KnowledgeCommunity.Web.Controllers
{
    public class TestController : Controller
    {
        //
        // GET: /Test/

        public ActionResult Index()
        {
            return View();
        }

        public Guid Swfupload()
        {
            string uploadsFolder = HttpContext.Server.MapPath("~/Upload");
            Guid identifier = Guid.NewGuid();
            string oldName = Path.GetFileName(Request.Files["Filedata"].FileName);
            string ext = Path.GetExtension(oldName);

            var uploadsPath = Path.Combine(uploadsFolder, identifier.ToString() + "." + ext);
            var httpfile = Request.Files["Filedata"];
            if (httpfile != null)
            {
                httpfile.SaveAs(uploadsPath);
            }
            return identifier;
        }

    }
}
